﻿
using Xacml.Core.Interfaces;
using Xacml.Core.Runtime;

namespace Xacml.Core.Runtime.Functions
{
  public class TimeGreaterThanOrEqual : BaseEqual
  {
    public override string Id
    {
      get
      {
        return "urn:oasis:names:tc:xacml:1.0:function:time-greater-than-or-equal";
      }
    }

    public override IDataType DataType
    {
      get
      {
        return (IDataType) DataTypeDescriptor.Time;
      }
    }

    public override EvaluationValue Evaluate(EvaluationContext context, params IFunctionParameter[] args)
    {
      if (this.GetTimeArgument(args, 0) >= this.GetTimeArgument(args, 1))
        return EvaluationValue.True;
      return EvaluationValue.False;
    }
  }
}
